/**
 * \file  antiviral_set_inline.h
 * \brief Inline methods of Antiviral_set class
 *
 * LAV: Lib Anti Virals
 * <http://lav.googlecode.com/>
 * Copyright (C) 2013  Boretto Martin, Lenarduzzi Federico, 
 *                    Alberione Fernando, Ocampo Emanuel FuDePAN
 *
 * This file is part of the LAV project.
 *
 * Contents:       Inline methods definitions of antiviral_set class.
 *
 * System:         LAV
 * Language:       C++
 *
 * Author:         Boretto Martin
 * E-Mail:         martinboretto@gmail.com
 *
 * Author:         Lenarduzzi Federico
 * E-Mail:         federicolenarduzzi@gmail.com
 * 
 * Author:         Alberione Fernando
 * E-Mail:         falberione037@gmail.com
 *
 * Author:         Ocampo Emanuel
 * E-Mail:         eocampo86@gmail.com
 *
 * LAV is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * LAV is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with LAV.  If not, see <http://www.gnu.org/licenses/>.
 *
 */


#ifndef ANTIVIRAL_SET_INLINE_H
#error Internal header file, DO NOT include this.
#endif

namespace lav
{

inline bool ExpandedResistance::operator== (const ExpandedResistance& other)
{
    return (pos == other.pos && triplet == other.triplet) ;
}


inline bool CombinationDistance::operator== (const CombinationDistance& other)
{
    return (distance == other.distance);
}

 
inline bool CombinationDistance::operator< (const CombinationDistance& other)
{
    return (distance < other.distance);
}


inline bool AntiviralSet::operator== (const AntiviralSet& other) const
{
    return antivirals == other.antivirals;
}


inline mili::bostream<>& operator<< (mili::bostream<>& bos, const AntiviralSet& avs)
{
	for (ArvsSet::iterator it = avs.antivirals.begin(); it != avs.antivirals.end(); ++it)
	{
		bos << (**it);
	}

	ResisBasedAntiviral aux("marca#end", 0, tComb, cComb);
	bos << aux;

	return bos;
}


inline mili::bistream<>& operator>> (mili::bistream<>& bis, AntiviralSet& avs)
{
	ResisBasedAntiviral* aux = new ResisBasedAntiviral("aux", 0, tComb, cComb);
	bis >> (*aux);

	AntiviralsNames name;
	aux->get_attrib("name", name);

	while (name != "marca#end")
	{
		avs.add_antiviral(*aux);
		aux = new ResisBasedAntiviral("aux", 0, tComb, cComb);
		bis >> *aux;
		aux->get_attrib("name", name);
	}
	return bis;
}

}